package com.mercury.pattern._10_flyweight;

import java.util.HashMap;
import java.util.Map;

/**
 *
 */
public class WebSiteFactory {
    //充当池的作用
    Map<String,WebSite> sites = new HashMap<>();

    public WebSite getWebSite(String type){
        if(!sites.containsKey(type)){
            sites.put(type,new ConcreteWebSite(type));
        }
        return sites.get(type);
    }

    public int getCount(){
        return sites.size();
    }
}